<template>
  <div class="w-full p-2 relative print-style bg-white h-full">
    <div class="flex justify-between w-full text-center items-center pl-60">
      <div class="flex-1 text-center text-[32px]">{{ getSystemConfig('HISNAME') }}</div>
      <BaseBarcode v-if="patientInfo.brName" :value="patientInfo.barcode" class="w-60 text-right" />
    </div>
    <div class="text-center text-[22px] font-bold">护理记录单</div>
    <div class="flex items-center justify-between mt-5">
      <div class="flex justify-start">
        <div class="">床位：{{ patientInfo.bqcw }}</div>
        <div class="ml-4">姓名：{{ patientInfo.brName }} {{ patientInfo.brXb }} {{ patientInfo.brAge }}</div>
      </div>
      <div class="flex justify-end">
        <div class="">住院号：{{ patientInfo.zyh }}</div>
        <div class="ml-4">入院日期：{{ patientInfo.ryrq }}</div>
        <div class="ml-4">科室：{{ patientInfo.ksmc }}</div>
        <div class="ml-4">诊断：{{ patientInfo.zd }}</div>
      </div>
    </div>
    <div class="flex-1 mt-2 text-sm">
      <div class="border border-solid border-b-0">
        <div class="flex w-full">
          <div class="table-border !border-t-0 !border-l-0 w-[60px]">日期</div>
          <div class="table-border !border-t-0 !border-l-0 w-[70px]">时间</div>
          <div class="table-border !border-t-0 !border-l-0 w-[70px]">意识</div>
          <div class="w-[60px]">
            <div class="table-border !border-t-0 !border-l-0">体温</div>
            <div class="table-border !border-t-0 !border-l-0">°C</div>
          </div>
          <div class="w-[60px]">
            <div class="table-border !border-t-0 !border-l-0">脉搏</div>
            <div class="table-border !border-t-0 !border-l-0">次/分</div>
          </div>
          <div class="w-[60px]">
            <div class="table-border !border-t-0 !border-l-0">收缩压</div>
            <div class="table-border !border-t-0 !border-l-0">次/分</div>
          </div>
          <div class="w-[60px]">
            <div class="table-border !border-t-0 !border-l-0">舒张压</div>
            <div class="table-border !border-t-0 !border-l-0">次/分</div>
          </div>
          <div class="table-border !border-t-0 !border-l-0 w-[60px]">坠床跌倒评分</div>
          <div class="table-border !border-t-0 !border-l-0 w-[70px]">Barthel指数评分</div>
          <div class="table-border !border-t-0 !border-l-0 w-[60px]">Braden评分</div>
          <div class="table-border !border-t-0 !border-l-0 flex-1">病情观察及护理措施</div>
          <div class="table-border !border-t-0 !border-l-0 w-[70px]">记录人</div>
          <div class="table-border !border-t-0 !border-l-0 !border-r-0 w-[70px]">签名</div>
        </div>
        <div v-for="(itemRow, indexRow) in tableData" :key="indexRow" class="flex w-full">
          <div class="table-border !border-t-0 !border-l-0 w-[60px]">{{ itemRow.jlrq }}</div>
          <div class="table-border !border-t-0 !border-l-0 w-[70px]">{{ itemRow.jlsj }}</div>
          <div class="table-border !border-t-0 !border-l-0 w-[70px]">{{ itemRow.ys }}</div>
          <div class="table-border !border-t-0 !border-l-0 w-[60px]">{{ itemRow.tw }}</div>
          <div class="table-border !border-t-0 !border-l-0 w-[60px]">{{ itemRow.mb }}</div>
          <div class="table-border !border-t-0 !border-l-0 w-[60px]">{{ itemRow.ssy }}</div>
          <div class="table-border !border-t-0 !border-l-0 w-[60px]">{{ itemRow.szy }}</div>
          <div class="table-border !border-t-0 !border-l-0 w-[60px]">{{ itemRow.zcddpf }}</div>
          <div class="table-border !border-t-0 !border-l-0 w-[70px]">{{ itemRow.barthe }}</div>
          <div class="table-border !border-t-0 !border-l-0 w-[60px]">{{ itemRow.braden }}</div>
          <div class="table-border !border-t-0 !border-l-0 flex-1">{{ itemRow.bqgc }}</div>
          <div class="table-border !border-t-0 !border-l-0 w-[70px]">{{ itemRow.jlr }}</div>
          <div class="table-border !border-t-0 !border-l-0 !border-r-0 w-[70px]"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { getSystemConfig } from '@/utils/systemConfig'

const props = defineProps({
  printData: {
    type: Object,
    default: () => ({})
  }
})

const patientInfo = ref({})
const tableData = ref([])

watch(
  () => props.printData,
  (val) => {
    tableData.value = val?.printData?.detail
    patientInfo.value = tableData.value[0] || {}
  }
)
</script>
<style lang="less" scoped>
.table-border {
  @apply border border-solid  p-1;
}
</style>
